package com.user.domain.dto;

import com.user.domain.pojo.Permission;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PermissionDto {
    private Long id;
    private String name;
    private String remark;
    private List<PermissionDto> children;

    public static PermissionDto convert(Permission permission) {
        PermissionDto permissionDto = new PermissionDto();
        permissionDto.setId(permission.getId());
        permissionDto.setName(permission.getName());
        permissionDto.setRemark(permission.getRemark());
        permissionDto.setChildren(new ArrayList<>());
        return permissionDto;
    }
}
